<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_subscribe.*,com.lmpop.trade.ti_user.*,com.lmpop.trade.ti_customer.*"%>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.frame.util.PageTools" %>
<%
	request.setCharacterEncoding("UTF-8");
	
	//Ti_customerInfo ti_customerInfo=new Ti_customerInfo();
	
	Ti_userInfo ti_personalInfo = new Ti_userInfo();
	
	Map ti_subscribe = new Hashtable();

	String _info_type = "",_enable="",_start_date="",_end_date="",_key_type="";


	if(request.getParameter("_key_type")!=null && !request.getParameter("_key_type").equals("")){
		_key_type = request.getParameter("_key_type");
		ti_subscribe.put("keyword",_key_type);
	}
	
	if(request.getParameter("_info_type")!=null && !request.getParameter("_info_type").equals("")){
		_info_type = request.getParameter("_info_type");
		ti_subscribe.put("info_type",_info_type);
	}
	
		if(request.getParameter("_enable")!=null && !request.getParameter("_enable").equals("")){
		_enable = request.getParameter("_enable");
		ti_subscribe.put("enabled",_enable);
	}
	
		if(request.getParameter("s_start_date")!=null && !request.getParameter("s_start_date").equals("")){
		_start_date = request.getParameter("s_start_date");
		ti_subscribe.put("start_date",_start_date);
	}	
	
	if(request.getParameter("s_end_date")!=null && !request.getParameter("s_end_date").equals("")){
		_end_date = request.getParameter("s_end_date");
		ti_subscribe.put("end_date",_end_date);
	}
	
	Ti_subscribeInfo ti_subscribeInfo = new Ti_subscribeInfo();
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ti_subscribeInfo.getListByPage(ti_subscribe,Integer.parseInt(iStart),limit);
	int counter = ti_subscribeInfo.getCountByObj(ti_subscribe);
	String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?_key_type="+
	_key_type+"&_enable="+_enable+"&s_start_date="+_start_date+"&s_end_date="+_end_date+"&_info_type="+_info_type+"&iStart=",Integer.parseInt(iStart),limit);
	
	String para ="_key_type="+_key_type+"&_enable="+_enable+"&s_start_date="
	+_start_date+"&s_end_date="+_end_date+"&_info_type="+_info_type+"&iStart="+Integer.parseInt(iStart);
%>
<html>
  <head>
    
    <title>商机订阅查看</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js"></script>
	<script type="text/javascript" src="js_subscribe.js"></script>
	<script language="javascript" type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>商机订阅查看</h1>
			</td>
		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post">
	
	<!--
	<table width="100%" align="center" cellpadding="0" cellspacing="0" class="dl_so">
        <tr>
          <td width="9%" align="center"><img src="/program/admin/index/images/ban_01.gif" /></td>
          <td width="91%" align="left">
		  <h4>-----------------</h4>
		  <span>1----------------。</span><br/>
		  <span>2----------------。</span>
		  </td>
        </tr>
      </table>
      <br/>
	  -->
	  
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left" >
			&nbsp;按关键字:<input name="_key_type" type="text" />
				&nbsp;按信息类型:
				<select name="_info_type" >
					<option value="">请选择</option>
					<option value="0">商品</option>
					<option value="1"> 卖家资讯</option>
					<option value="2"> 平台资讯</option>
				</select>
			
			&nbsp;	按是否有效:	
				<select name="_enable" >
					<option value="">请选择</option>
					<option value="0">有效</option>
					<option value="1"> 无效</option>
				</select>
				
			&nbsp;按订阅时间段:
									
						<input name="s_start_date" type="text" id="s_start_date" class="Wdate" value="" onclick="WdatePicker({maxDate:'#F{$dp.$D(\'s_end_date\',{d:-1})}',readOnly:true})" size="15"  width="150px"/>
              -
	          <input name="s_end_date" id="s_end_date" type="text" class="Wdate" value="" onclick="WdatePicker({minDate:'#F{$dp.$D(\'s_start_date\',{d:1})}',readOnly:true})" size="15" width="150px"/>
				
				<input name="searchInfo" type="button" value="搜索" onclick="searchForm();" />	
			</td>
		</tr>
	</table>

	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" onclick="selectAll()"></th>
			
		  	<th>会员名称</th>
	
		  	<th>关键字</th>
		  	
		  	<th>信息类型</th>
		
		  	<th>是否有效</th>
		  	
		  	<th>订阅时间</th>
		  	
			<th width="10%">查看</th>
	  		<th width="10%">删除</th>
		</tr>
		
		<% 
		  		for(int i=0;i<list.size();i++){
		  			Hashtable map = (Hashtable)list.get(i);
		  			String info_id="",user_id="",cust_id="",info_type="",keyword="",cat_id_group="",ch_id_group="",info_num="",send_type="",enabled="",rsrv_str1="",rsrv_str2="",rsrv_str3="",in_date="";
		  			  String user_name="",cust_name="";
		  			  String __info_type="",__enabled="";
		  			  	if(map.get("info_id")!=null) info_id = map.get("info_id").toString();
  	if(map.get("user_id")!=null) user_id = map.get("user_id").toString();
  	if(map.get("cust_id")!=null) cust_id = map.get("cust_id").toString();
  	  	 user_name=ti_personalInfo.getPersonalNameByUserId(user_id);
  			 	//cust_name =	ti_customerInfo.getCustNameByCustId(cust_id);
  			 
  	if(map.get("info_type")!=null) info_type = map.get("info_type").toString();
  	__info_type=info_type;
  	if(info_type.equals("0")) info_type="商品";
  		if(info_type.equals("1")) info_type="卖家资讯";
  			if(info_type.equals("2")) info_type="平台资讯";
  			
  			
  	if(map.get("keyword")!=null) keyword = map.get("keyword").toString();
  	
  	if(map.get("cat_id_group")!=null) cat_id_group = map.get("cat_id_group").toString();
  	if(map.get("ch_id_group")!=null) ch_id_group = map.get("ch_id_group").toString();
  	if(map.get("info_num")!=null) info_num = map.get("info_num").toString();
  	if(map.get("send_type")!=null) send_type = map.get("send_type").toString();
  	  	if(send_type.equals("0")) send_type="站内信";
  	  	  if(send_type.equals("1")) send_type="邮箱";

  	if(map.get("enabled")!=null) enabled = map.get("enabled").toString();
  	__enabled=enabled;
  		if(enabled.equals("0")) enabled="有效";
  	  	if(enabled.equals("1")) enabled="无效";
  	
  	if(map.get("rsrv_str1")!=null) rsrv_str1 = map.get("rsrv_str1").toString();
  	if(map.get("rsrv_str2")!=null) rsrv_str2 = map.get("rsrv_str2").toString();
  	if(map.get("rsrv_str3")!=null) rsrv_str3 = map.get("rsrv_str3").toString();
  	if(map.get("in_date")!=null) in_date = map.get("in_date").toString();
	  if(in_date.length()>19)in_date=in_date.substring(0,19);

		  %>
		
		<tr>
			<td width="5%" align="center"><input type="checkbox" name="checkone<%=i %>" id="checkone<%=i %>" value="<%=info_id %>" /></td>
			
		  	<td><%=user_name%></td>
		  			  
		  	<td><%=keyword%></td>
		  			  	
		  	<td><a href="index.jsp?info_type=<%=__info_type%>"><%=info_type%></a></td>
		  	
		  	<td><a href="index.jsp?enabled=<%=__enabled%>"><%=enabled%></a></td>
		  	
		  	<td><%=in_date%></td>
		  	
			<td width="10%"><a href="updateInfo.jsp?info_id=<%=info_id %>&<%=para%>"><img src="/program/admin/images/edit.gif" title="查看" /></a></td>
	  		<td width="10%"><a href="javascript:deleteOneInfo('<%=info_id%>','8346');"><img src="/program/admin/images/delete.gif" title="删除" /></a></a></td>
		</tr>
		
		  <%
		  		}
		  %>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<%
		 }
	%>
	
	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="8346" />
	  </form>
</body>

</html>
